﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using KPIS.GERP.GFMS.MODEL;
using KPIS.GERP.GFMS.IBLL;
using KPIS.GERP.GFMS.BLL;

namespace KPIS.GERP.GFMS.APP.App_UI.Forms
{
    public partial class Default : System.Web.UI.Page
    {
        IBLL_FIM_SystemControls sc = new B_FIM_SystemControls();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                HttpCookie cookie = Request.Cookies["UserDetail"];

                
                if (cookie != null && 
                    !string.IsNullOrEmpty(cookie["EmpSeq"]) && 
                    Convert.ToString(Session["EmpSeq"]) != Convert.ToString(cookie["EmpSeq"]))
                {
                    Session["EmpSeq"] = cookie["EmpSeq"];
                    Session["UserName"] = cookie["UserName"];
                    Session["UserJobsiteSeq"] = cookie["WorkingJobSiteSeq"];
                    Session["UserInternalJobsiteSeq"] = cookie["WorkingJobSiteSeq"];
                    Session["UserWorkAreaSeq"] = null;
                    Session["Height"] = cookie["Height"];
                    Session["SCInfo"] = GetSystemControl();
                }
            }
        }

        private M_FIM_SystemControls GetSystemControl()
        {
            M_FIM_SystemControls info = sc.GetInfo();

            return info;
        }
    }
}
